package cn.maxhou.mapper;

import cn.maxhou.pojo.Supplier;
import cn.maxhou.utils.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.apache.log4j.Logger;
import org.junit.Test;

import java.util.List;

public class SupplierMapperTest3 {

    private Logger logger = Logger.getLogger(SupplierMapperTest3.class);

    @Test
    public void testCount() {
       SqlSession sqlSession= MyBatisUtil.createSqlSession();
        int count = sqlSession.getMapper(SupplierMapper.class).Count();

        logger.debug("SupplierMapperTest3.count() ---> " + count);
        MyBatisUtil.closeSqlSession(sqlSession);
    }

    @Test
    public void testSelect() {
        SqlSession sqlSession= MyBatisUtil.createSqlSession();
        List<Supplier> suppliers =sqlSession.getMapper(SupplierMapper.class).selectAll();

        for (Supplier supplier : suppliers) {
            logger.debug(supplier.toString());
        }

        MyBatisUtil.closeSqlSession(sqlSession);
    }
}